import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router'
import HomeView from '../views/HomeView.vue'

const routes: Array<RouteRecordRaw> = [
  {
      path: '/',
      redirect:'/login',

  },
  {
    path: '/about',
    name: 'about',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "about" */ '../views/AboutView.vue')
  },{ // 路由-- path name component
       path:'/hello',
        name:'hello',
        component:()=>import('../views/test/Hello.vue')
  },{ // 复合路由
       path:'/doc',
       name:'doc',
       component:()=>import('../views/layout/Index.vue'),
        children:[
            {
                path:'basic',
                name:'basic',
                component:()=>import('../views/doc/Basic.vue')

            },{
                path:'hello3',
                name:'hello3',
                component:()=>import('../views/test/Hello3.vue')

            }
        ]

  },{
        path:'/login',
        name:'login',
        component:()=>import('../views/ex/Login.vue')
    }
]

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes
})

export default router
